<template>
	<HyForm :hyFormDefault="fileListDefault" :hyFormConfig="hyFormConfig" :hyFormFields="hyFormFields" ref="hyFormRef" />
</template>
<script setup lang="ts">
import HyForm from '/@/components/HyForm/index.vue';
import { defaultValue } from '../../utils/default';
const { fileListDefault } = defaultValue();
const formType: any = inject('formType', 'submit');

const hyFormFields = computed(() => {
	return {
		officialDocumentsFileIdList: {
			label: '涉及部门审查意见函的正式公文',
			type: 'upload',
			required: true,
			fileSize: 200,
			fileType: ['.pdf'],
		},
		threeListFileIdList: {
			label: '三张清单',
			type: 'upload',
			required: true,
			fileSize: 200,
			fileType: ['.docx'],
		},
		integrationDiagramFileIdList: {
			label: '多跨场景拆解集成图',
			type: 'upload',
			required: true,
			fileSize: 200,
			fileType: ['.jpg', '.jpeg', '.png'],
		},
		requirementsDiagramsFileIdList: {
			label: '数据需求图',
			type: 'upload',
			required: true,
			fileSize: 200,
			fileType: ['.jpg', '.jpeg', '.png'],
		},
		architectureDiagramFileIdList: {
			label: '核心业务架构图',
			type: 'upload',
			required: true,
			fileSize: 200,
			fileType: ['.jpg', '.jpeg', '.png'],
		},
	};
});
const hyFormConfig = computed(() => {
	return {
		labelWidth: '120px',
		type: formType.value,
	};
});
const props: any = defineProps({
	fileListData: {
		type: Object,
		default: () => {
			return {};
		},
	},
});
watch(
	[() => props],
	([nv1]) => {
		const { fileListData } = nv1;
		nextTick(() => {
			if (fileListData) {
				hyFormRef.value.hyForm = nv1.fileListData;
			}
		});
	},
	{ deep: true, immediate: true }
);
const hyFormRef = ref();
const getData = () => {
	return hyFormRef.value.hyForm;
};
const check = async () => {
	const result = await hyFormRef.value.check();
	return result;
};
defineExpose({ getData, check });
</script>
<style scoped lang="scss"></style>
